1 <?php
2 require("../includes/config.php");
3 session_start();
4 if(isset($_SESSION['manufacturer_login'])) {
5 if(isset($_GET['id'])){
6 $invoice_id = $_GET['id'];
7 $queryInvoiceItems = "SELECT *,invoice_items.quantity as quantity FROM invoice,invoice_items,products WHERE invoice.invoice_id='$invoice_id' AND invoice_items.product_id=products.pro_id AND invoice_items.invoice_id=invoice.invoice_id";
8 $resultInvoiceItems = mysqli_query($con,$queryInvoiceItems);
9 $querySelectInvoice = "SELECT * FROM invoice,retailer,distributor,area WHERE invoice_id='$invoice_id' AND invoice.retailer_id=retailer.retailer_id AND retailer.area_id=area.area_id AND invoice.dist_id=distributor.dist_id";
10 $resultSelectInvoice = mysqli_query($con,$querySelectInvoice);
11 $rowSelectInvoice = mysqli_fetch_array($resultSelectInvoice);
12 }
13 }
14 else {
15 header('Location:../index.php');
16 }
17 ?>
18
19 <!DOCTYPE html>
20 <html>
21 <head>
22 <title> View Invoice Details </title>
23 <link rel="stylesheet" href="../includes/main_style.css" >
24 <script type="text/javascript">
25 function PrintDiv() {
26 document.getElementById("signature").style.display = "block";
27 document.getElementById("footer").style.display = "block";
28 var divToPrint = document.getElementById('divToPrint');
29 var popupWin = window.open('', '_blank', '');
30 popupWin.document.open();
31 popupWin.document.write('<html><body onload="window.print()">' + divToPrint.innerHTML + '</html>');
32 document.getElementById("signature").style.display = "none";
33 document.getElementById("footer").style.display = "none";
34 popupWin.document.close();
35 }
36 </script>
37 </head>
38 <body>
39 <?php
40 include("../includes/header.inc.php");
41 include("../includes/nav_manufacturer.inc.php");
42 include("../includes/aside_manufacturer.inc.php");
43 ?>
44 <section>
45 <div id="divToPrint" style="clear:both;" >
46 <h1 style="text-align:center;">Sales Invoice</h1>
47 <table class="table_infoFormat">
48 <tr>
49 <td><b> Invoice No: </b></td>
50 <td> <?php echo $rowSelectInvoice['invoice_id']; ?> </td>
51 </tr>
52 <tr>
53 <td><b> Order No: </b></td>
54 <td> <?php echo $rowSelectInvoice['order_id']; ?> </td>
55 </tr>
56 <tr>
57 <td><b> Retailer: </b></td>
58 <td> <?php echo $rowSelectInvoice['area_code']; ?> </td>
59 </tr>
60 <tr>
61 <td><b> Distributor: </b></td>
62 <td> <?php echo $rowSelectInvoice['dist_name']; ?> </td>
63 </tr>
64 <tr>
65 <td><b> Date: </b></td>
66 <td> <?php echo date("d-m-Y",strtotime($rowSelectInvoice['date'])); ?> </td>
67 </tr>
68 </table>
69 <form action="" method="POST" class="form">
70 <table class="table_invoiceFormat" style="margin-top:50px;">
71 <tr>
72 <th style="padding-right:25px;"> Sr. No. </th>
73 <th style="padding-right:150px;"> Products </th>
74 <th style="padding-right:30px;"> Unit Price </th>
75 <th style="padding-right:30px;"> Quantity </th>
76 <th> Amount </th>
77 </tr>
78 <?php $i=1; while($rowInvoiceItems = mysqli_fetch_array($resultInvoiceItems)) { ?>
79 <tr>
80 <td> <?php echo $i; ?> </td>
81 <td> <?php echo $rowInvoiceItems['pro_name']; ?> </td>
82 <td> <?php echo $rowInvoiceItems['pro_price']; ?> </td>
83 <td> <?php echo $rowInvoiceItems['quantity']; ?> </td>
84 <td> <?php echo $rowInvoiceItems['quantity']*$rowInvoiceItems['pro_price']; ?> </td>
85 </tr>
86 <?php $i++; } ?>
87 <tr style="height:40px;vertical-align:bottom;">
88 <td colspan="4" style="text-align:right;"><b> Grand Total: </b></td>
89 <td>
90 <?php
91 mysqli_data_seek($resultInvoiceItems,0);
92 $rowInvoiceItems = mysqli_fetch_array($resultInvoiceItems);
93 echo $rowInvoiceItems['total_amount'];
94 ?>
95 </td>
96 </tr>
97 </table><br/><br/>
98 <b>Comments:</b> <br/> <?php echo $rowSelectInvoice['comments']; ?>
99 <br/><br/><br/><br/><br/><br/>
100 <p id="signature" style="float:right;display:none;">(Authorized Signatory)</p>
101 <p id="footer" style="clear:both;display:none;padding-bottom:20px;text-align:center;">Thank you for your Bussiness!</p>
102 </div>
103 <input type="button" value="Print Invoice" class="submit_button" onclick="PrintDiv();" />
104 </form>
105 </section>
106 <?php
107 include("../includes/footer.inc.php");
108 ?>
109 </body>
110 </html>